home *** CD-ROM | disk | FTP | other *** search
/ PC for Alla 2005 May / PC för Alla 0505.iso / fullversioner / realsoft3d / data1.cab / Scripting / scripting / Intro / file.js < prev    next >
Encoding:
Text File  |  2005-04-04  |  584 b   |  29 lines

  1. include("oops/r3file.js");
  2.  
  3. // open file for writing in ascii mode
  4. file = new r3File(R3FIA_FileName, "jstest.txt",
  5.                   R3FIA_Mode, "wa+");
  6.  
  7. // write a couple of strings to a file
  8. file.PUTS("This string was written by PUTS method\n");
  9. file.PUTS("Another string written by PUTS\n");
  10.  
  11. // close the file
  12. file.DELETE();
  13.  
  14. // open file for reading
  15. file = new r3File(R3FIA_FileName, "jstest.txt",
  16.                   R3FIA_Mode, "ra+");
  17.  
  18. // read
  19. str = new String();
  20. while(file.GETS([0])) {
  21.     str += file.GetBuffer();
  22. }
  23.  
  24. print(str);
  25.  
  26. file.DELETE();
  27.  
  28.  
  29.